load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "importinto",
    srcs = [
        "clean_s3.go",
        "encode_and_sort_operator.go",
        "job.go",
        "metrics.go",
        "planner.go",
        "proto.go",
        "scheduler.go",
        "subtask_executor.go",
        "task_executor.go",
        "wrapper.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/disttask/importinto",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/lightning/backend",
        "//br/pkg/lightning/backend/external",
        "//br/pkg/lightning/backend/kv",
        "//br/pkg/lightning/checkpoints",
        "//br/pkg/lightning/common",
        "//br/pkg/lightning/config",
        "//br/pkg/lightning/log",
        "//br/pkg/lightning/metric",
        "//br/pkg/lightning/mydump",
        "//br/pkg/lightning/verification",
        "//br/pkg/logutil",
        "//br/pkg/storage",
        "//br/pkg/utils",
        "//pkg/config",
        "//pkg/disttask/framework/handle",
        "//pkg/disttask/framework/planner",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/scheduler",
        "//pkg/disttask/framework/storage",
        "//pkg/disttask/framework/taskexecutor",
        "//pkg/disttask/framework/taskexecutor/execute",
        "//pkg/disttask/operator",
        "//pkg/domain/infosync",
        "//pkg/errno",
        "//pkg/executor/importer",
        "//pkg/kv",
        "//pkg/meta/autoid",
        "//pkg/metrics",
        "//pkg/parser/ast",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/resourcemanager/pool/workerpool",
        "//pkg/resourcemanager/util",
        "//pkg/sessionctx",
        "//pkg/table/tables",
        "//pkg/util",
        "//pkg/util/backoff",
        "//pkg/util/dbterror/exeerrors",
        "//pkg/util/disttask",
        "//pkg/util/etcd",
        "//pkg/util/logutil",
        "//pkg/util/promutil",
        "//pkg/util/size",
        "//pkg/util/sqlexec",
        "@com_github_docker_go_units//:go-units",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_google_uuid//:uuid",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_tikv_client_go_v2//util",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "importinto_test",
    timeout = "short",
    srcs = [
        "encode_and_sort_operator_test.go",
        "job_testkit_test.go",
        "metrics_test.go",
        "planner_test.go",
        "scheduler_test.go",
        "scheduler_testkit_test.go",
        "task_executor_test.go",
        "task_executor_testkit_test.go",
        "wrapper_test.go",
    ],
    embed = [":importinto"],
    flaky = True,
    race = "on",
    shard_count = 16,
    deps = [
        "//br/pkg/lightning/backend",
        "//br/pkg/lightning/backend/external",
        "//br/pkg/lightning/checkpoints",
        "//br/pkg/lightning/config",
        "//br/pkg/lightning/mydump",
        "//pkg/ddl",
        "//pkg/disttask/framework/planner",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/scheduler",
        "//pkg/disttask/framework/storage",
        "//pkg/disttask/framework/testutil",
        "//pkg/disttask/importinto/mock",
        "//pkg/disttask/operator",
        "//pkg/domain/infosync",
        "//pkg/executor/importer",
        "//pkg/kv",
        "//pkg/meta/autoid",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/model",
        "//pkg/session",
        "//pkg/testkit",
        "//pkg/util/mock",
        "//pkg/util/sqlexec",
        "@com_github_docker_go_units//:go-units",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_stretchr_testify//require",
        "@com_github_stretchr_testify//suite",
        "@com_github_tikv_client_go_v2//util",
        "@org_uber_go_mock//gomock",
        "@org_uber_go_zap//:zap",
    ],
)
